package net.pojoin.listener;

import net.pojoin.CalculatorActivity;
import android.text.Editable;
import android.text.Selection;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;

public abstract class GeneralListener implements OnClickListener {

	private CalculatorActivity activity;
	
	public GeneralListener(CalculatorActivity activity){
		this.activity = activity;
	}
	
	/**
	 * 获取calculatorActivity
	 * @return
	 */
	public CalculatorActivity getCalculatorActivity(){
		return this.activity;
	}
	/**
	 * 点击事件
	 */
	public void onClick(View v) {
		
	}
	
	/**
	 * 设置光标总在右侧
	 * @param editText
	 */
	public void resetSelection(EditText editText){
		Editable editable = editText.getText();
		int position = editable.length();
		Selection.setSelection(editable, position);
	}

}
